const getters = {
  device: state => state.app.device,
  theme: state => state.app.theme,
  color: state => state.app.color,
  multiTab: state => state.app.multiTab,

  token: state => state.user.token,
  welcome: state => state.user.welcome,
  roles: state => state.user.roles,
  userInfo: state => state.user.info,
  /** 用户岗位（权限） */
  positions: state => {
    const positions = state.user.info.positions
    return positions && JSON.parse(positions) || []
  },
  /** 用户id(非身份证号) */
  userId: state => state.user.info.id,
  /** 用户身份证号 */
  userPId: state => state.user.info.pid,
  /** 用户头像 */
  avatar: state => state.user.avatar,
  /** 用户名 */
  nickname: state => state.user.name,
  /** 用户密级 */
  userSecretLevel: state => parseInt(state.user.info.secretLevel),

  addRouters: state => state.permission.addRouters,
  wxid: state => state.user.wxid,
  keepAliveList: state => state.user.keepAliveList,
  hitstoryRefreshFlag: state => state.user.hitstoryRefreshFlag
}

export default getters
